package com.itheima.demo;

import java.math.BigDecimal;

public class MyBigDecimalDemo {
    public static void main(String[] args) {
        BigDecimal bd1 = new BigDecimal("10.0");
        BigDecimal bd2 = new BigDecimal("3.0");

        System.out.println(bd1.add(bd2));
        System.out.println(bd1.subtract(bd2));
        System.out.println(bd1.multiply(bd2));
//        System.out.println(bd1.divide(bd2));
        System.out.println("四舍五入：10/3="+bd1.divide(bd2, 2, BigDecimal.ROUND_HALF_UP));
        System.out.println("进一法：10/3="+bd1.divide(bd2, 2, BigDecimal.ROUND_UP));
        System.out.println("去尾法：10/3="+bd1.divide(bd2, 2, BigDecimal.ROUND_FLOOR));
    }
}
